package com.socket.netty;




import java.net.ServerSocket;
import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;

/**
 * Created by kaddddd on 2017/11/17 0017.
 */
public class SocketServer {
    public static void main(String[] args) {
        int i=1;
        try {
            ServerSocket server = new ServerSocket(8085);
            while(true){
                 Socket client=server.accept();
                 System.out.println("Spawning  "+i);
                 Runnable r= new ThreadDataHandler(client);
                 Thread t=new Thread(r);
                 t.start();
                 i++;
             }

        } catch (UnknownHostException e1) {
            e1.printStackTrace();
        } catch (IOException e1) {
            e1.printStackTrace();
        }
    }
}
